<template>
	<view>
		<view class="deposit-msg">
			<view class="add-address-details">
				<view class="add-address-title">认证名字</view>
				<view class="add-address-textarea">
					<input type="text"  v-model="name" value="" placeholder="请输入你的真实姓名"/>
				</view>
			</view>
			<view class="add-address-details">
				<view class="add-address-title">手机号码</view>
				<view class="add-address-textarea">
					<input type="text"  v-model="phone" value="" placeholder="请输入微信绑定手机号码"/>
				</view>
			</view>
			<view class="add-address-details" style="border: none;">
				<view class="add-address-title">提现金额</view>
				<view class="add-address-textarea">
					<input type="text"  v-model="amount" value="" placeholder="请输入你的提现金额"/>
				</view>
			</view>
			<view class="deposit-btn"  @click="depositClick">
				提现
			</view>
		</view>
		<view class="deposit-explain">
			<view class="explain-title">
				<view class=""></view>
				<view class="">
					提现说明
				</view>
			</view>
			<view class="deposit-explain-content">
				<view class="">
					1.单笔提现金额最低1元，提现一般1-3个工作日到账，请留意微信通知。如提现3天还没有到账，请联系“ 客服人员”。
				</view>
				<view class="">
					2.如果出现提现失败，请第一时间联系“客服人员”。
				</view>
			</view>
		</view>
		<!-- 申请提现成功弹框 -->
		<uni-popup ref="depositSucced" :custom="true">
			<view class="popup_box_de">
				<view class="popup_box-tip">
					申请提现成功
				</view>
				<view class="popup_box-reminder">
				1-3个工作日到账
				</view>
				<view class="popup_box-click" @click="close">
					确定
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	import uniPopup from '@/components/uni-popup/uni-popup.vue'
	export default{
		components:{uniPopup},
		data(){
			return {
				store_id:"",
				amount:0,
				name:'',
				phone:''
			}
		},
		onLoad(options) {
			let store_id = parseInt(options.store_id,10);
			console.log('进入了onload 获取url的store_id',store_id)
			if(!store_id > 0){
				store_id = uni.getStorageSync('store_id')?parseInt(uni.getStorageSync('store_id'),10):0
			}else{
				uni.setStorageSync('store_id', store_id)
			}
			let price = parseInt(options.price,10);
			if(price > 0){
				this.amount = price
			}
			this.store_id = parseInt(store_id,10)
			this.$store.commit('updateStoreId',store_id)
		},
		methods:{
			close(){
				this.$refs.depositSucced.close()
			},
			depositClick(){
				const that = this;
				const data = {
					token:that.$store.getters.token,
					type:2,
					money:that.amount,
					username:that.name,
					phone:that.phone,
				}
				that.$api.recommend_withdrawal(data).then(res => {
					if(res.status){
						this.$refs.depositSucced.open()
					}else{
						uni.showToast({
							title:res.msg,
							icon:"none",
							duration:2000
						})
					}
				}).catch(err => {
					console.log(err,'that.$api.withdraw')
				})
			},
		}
	}
</script>

<style>
	/* 弹框样式 */
	.popup_box_de{
		height: 336upx;
		width: 640upx;
		background: #FFFFFF;
		border-radius: 24upx;
		padding-top: 50upx;
		box-sizing: border-box;
	}
	.popup_box-tip{
		text-align: center;
		color: #353535;
		font-size: 36upx;
		font-weight: 800;
	}
	.popup_box-reminder{
		width: 544upx;
		text-align: center;
		padding: 0 10upx;
		box-sizing: border-box;
		color: #FF5C46;
		font-size: 30upx;
		margin: 0 auto;
		margin-top: 36upx;
	}
	.popup_box-click{
		width: 100%;
		height: 110upx;
		margin-top: 66upx;
		border-top: 1upx solid rgba(0, 0, 0, 0.1);
		color: #FF8B46;
		font-size: 34upx;
		text-align: center;
		line-height: 110upx;
	}
	page{
		background: #F3F3F4;
	}
	.deposit-msg{
		width: 100%;
		padding-left: 30upx;
		padding-bottom: 30upx;
		box-sizing: border-box;
		background: #FFFFFF;
	}
	.add-address-details{
		width: 100%;
		height: 100upx;
		padding: 32upx 30upx 28upx 0;
		box-sizing: border-box;
		display: flex;
		border-bottom: 1upx solid #DEDEDE;
	}
	.add-address-title{
		font-size: 28upx;
		color: #666666;
	}
	.add-address-textarea{
		position: relative;
		flex-grow: 1;
		margin-left: 40upx;
	}
	.add-address-details>view>input{
		font-size: 28upx;
		flex-grow: 1;
	}
	.deposit-btn{
		width: 638upx;
		height: 88upx;
		line-height: 88upx;
		text-align: center;
		color: #FFFFFF;
		font-size: 32upx;
		margin: 0 auto;
		margin-top: 50upx;
		border-radius: 44upx;
		background: linear-gradient(to right,#FE9543,#FF664F);
		box-shadow: 0 8upx 16upx 0 rgba(166, 13, 0, 0.23);
	}
	.deposit-explain{
		width: 100%;
		margin-top: 20upx;
		background: #FFFFFF;
		padding: 0 30upx;
		padding-bottom: 30upx;
		box-sizing: border-box;
	}
	.explain-title{
		display: flex;
		padding: 30upx 0 22upx;
		box-sizing: border-box;
		border-bottom: 1upx solid #DEDEDE;
	}
	.explain-title>view:first-child{
		width: 8upx;
		height: 32upx;
		background: #FF8B46;
		vertical-align: middle;
		margin-top: 6upx;
	}
	.explain-title>view:last-child{
		color: #333333;
		font-size: 34upx;
		margin-left: 10upx;
	}
	.deposit-explain-content>view{
		margin-top: 30upx;
		color: #666666;
		font-size: 28upx;
	}
</style>
